package com.acwing.chapter3;

import java.io.*;
import java.util.Arrays;

/**
 * @author anan
 * @create 2021-08-30 12:09
 */
public class HashKaiangxunzhi {
    private static int N = 200003;
    private static int MEN = (int) (Math.pow(10, 9) + 1);
    private static int[] h = new int[N];

    private static void init(){
        Arrays.fill(h, MEN);
    }

    private static int find(int x){
        int k = (x % N + N) % N;
        while (h[k] != MEN && h[k] != x) k++;
        return k;
    }

    public static void main(String[] args) throws IOException {
        init();
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] str1 = reader.readLine().split(" ");
        int n = Integer.parseInt(str1[0]);

        while (n-- > 0){
            String[] str2 = reader.readLine().split(" ");
            int x = Integer.parseInt(str2[1]);
            int k = find(x);
            if ("I".equals(str2[0])) h[k] = x;
            else if ("Q".equals(str2[0])){
                if (h[k] == MEN) writer.write("No" + "\n");
                else writer.write("Yes" + "\n");
            }
        }

        writer.flush();
        writer.close();
        reader.close();
    }
}
